﻿package cocoaas3{
	public class NSIndexPath{

		private var _row:uint;
		public function get row():uint{ return _row; }

		private var _section:uint;
		public function get section():uint{ return _section; }



		public function NSIndexPath( $row:uint, $section:uint ){
			_row = $row;
			_section = $section;
		}


		// ふたつのインデックスパスを比較する
		static public function compare( ip1:NSIndexPath, ip2:NSIndexPath ):Boolean{
			if( ip1.row==ip2.row && ip1.section==ip2.section ){
				return true;
			} else {
				return false;
			}
		}

		// 文字列から作成
		static public function makeFromString( str:String ):NSIndexPath{
			var ary:Array = str.split( "," );
			return new NSIndexPath( ary[0], ary[1] );
		}


		public function toString( simple:Boolean=false ):String{
			if( simple ){
				return String( row +","+ section );
			} else {
				return "[NSIndexPath] row="+ row +" section="+ section;
			}
		}
	}
}